<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../jsLib/angular.js"></script>
    <title></title>
</head>
<body ng-app="app" >
   <div ng-controller="my1">
       <h3 ng-bind="name"></h3>

   </div>
   <div ng-controller="my2">
       <h4 ng-bind="hello"></h4>
   </div>
   <script>
       var app=angular.module('app',[]);
       app.service('chandi',function(){
           this.users={};
           this.users.name='angulerJS'
       })
       app.controller('my1',function($scope,chandi){
         $scope.name=chandi.users.name
           chandi.users.name="不难"

       })
       app.controller('my2',['$scope','chandi',function(a,b){
           a.hello= b.users.name

       }])
   </script>
</body>
</html>